<?php
$this->pageTitle = Yii::app()->name;
$this->breadcrumbs=array(
	$title,
);
include_once('groupMenu.php');
?>
<div style="width:100%; float:left; margin-bottom:10px; text-align:right;">
	<form action="" name="jobForm" id="jobForm" method="get">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" class="td_right">组合编号: </td>
			<td width="35%"><input type="text" name="groupName" value="<?php if(isset($search['groupName']))echo $search['groupName'];?>" id="groupName" class="input_size4" /></td>
			<td width="15%" class="td_right">组合标题: </td>
			<td><input type="text" name="groupTitle" value="<?php if(isset($search['groupTitle']))echo $search['groupTitle'];?>" id="groupTitle" class="input_size4" /></td>
		</tr>	
		<tr>
			<td class="td_right">创建者: </td>
			<td><input type="text" name="creator" value="<?php if(isset($search['creator']))echo $search['creator'];?>" id="creator" class="input_size4" /></td>
			<td class="td_right">编辑者: </td>
			<td><input type="text" name="editor" value="<?php if(isset($search['editor']))echo $search['editor'];?>" id="editor" class="input_size4" /></td>
		</tr>	
		<tr>
			<td class="td_right">更新时间: </td>
			<td colspan="2">
				<input type="text" name="s" id="s" value="<?= $search['s'] ?>" readonly="readonly" style="width:100px;" />
				<img onclick="displayCalendar(document.jobForm.s,'yyyy-mm-dd',this)" style="cursor:pointer;" src="images/calendar.png" /> - 
				<input type="text" name="e" id="e" value="<?= $search['e'] ?>" readonly="readonly" style="width:100px;" />
				<img onclick="displayCalendar(document.jobForm.e,'yyyy-mm-dd',this)" style="cursor:pointer;" src="images/calendar.png" />
			</td>
			<td style="text-align:right;">
				<a style="margin-right:30px;" onclick="return confirm('确认要删除关键字表?')" href="<?=Yii::app()->createUrl('admin/deleteXls')?>"><img src="images/delete.png" border="0" /></a>
				<a style="margin-right:30px;" href="###" onclick="exportData()"><img src="images/down.png" border="0" /></a>
				<a style="margin-right:30px;" href="<?=Yii::app()->createUrl('admin/productGroup')?>"><img src="images/shua.png" border="0" /></a>
				<input type="image" src="images/go.png" name="jobSub" id="jobSub" value="Go" />
			</td>
		</tr>
	</table>				
		<input type="hidden" name="r" value="admin/productGroup" />
	</form>
</div>
<form name="exportForm" id="exportForm" action="" method="post">
<table cellspacing="0" cellpadding="0" width="100%" class="tbl" style="float:left;">
	<tr class="head">
		<td width="2%"><input type="checkbox" name="checkAll" id="checkAll"></td>
		<td width="20%">组合编号</td>
		<td width="60%">组合标题</td>
		<td>详情</td>
	</tr>
	<?php
    $i = 0;
    $cssArr = array(0 => 'even', 1 => 'odd', 2 => 'three');
    foreach ($rowTable as $item) {
        $trClass = $cssArr[$i % 3];
        $i++;
        ?>
	<tr class="<?= $trClass ?>">
		<td style="text-align:center;"><input type="checkbox" name="groupId[]" id="groupId_<?=$item->groupId?>" value="<?=$item->groupId?>"></td>
		<td>
			<?=$item->groupName?>
		</td>
		<td>
			<?=$item->groupTitle?>
		</td>
		<td style="text-align:center;">
			<a href="<?=Yii::app()->createUrl('admin/ProductGroupUpdate',array('groupId'=>$item->groupId))?>">详情</a>
		</td>
	</tr>
	<?php
    }
    ?>
</table>
<div id="pager" align="center">
<?php  
	$this->widget('CLinkPager',array(  
		'header'=>'',  
		'firstPageLabel' => '<<',
		'lastPageLabel' => '>>',
		'prevPageLabel' => '<',
		'nextPageLabel' => '>',
		'pages' => $pages,  
		'maxButtonCount'=>13  
		));  
?>
</div>
</form>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
$(document).on('click','#checkAll',function() {
	var checked=this.checked;
	$("input[name='groupId\[\]']").each(function() {this.checked=checked;});
});
$(document).on('click', "input[name='groupId\[\]']", function() {
	$('#groupId').prop('checked', $("input[name='groupId\[\]']").length==$("input[name='groupId\[\]']:checked").length);
});
});
function exportData(){
	document.getElementById('exportForm').action = '<?=Yii::app()->createUrl('admin/exportGroup',$search)?>';
	document.getElementById('exportForm').submit();
}
/*]]>*/
</script>